import { createRouter, createWebHashHistory } from 'vue-router'
import login from '../view/Login.vue'
import home from '../view/Home.vue'
import main from '../view/Main.vue'
import hotlist from '../view/HotList.vue'
import carton from '../view/Carton.vue'
import games from '../view/Games.vue'
import tattle from '../view/Tattle.vue'
import rank from '../view/Rank.vue'
import shopping from '../view/Shopping.vue'
import self from '../view/Self.vue'
import content from '../view/Content.vue'
import release from '../view/Release.vue'
import noticearticle from '../view/NoticeArticle.vue'
import cartonrank from '../view/CartonRank.vue'
import gamerank from '../view/GameRank.vue'
import managerlogin from '../view/ManagerLogin.vue'
import managermain from '../view/ManagerMain.vue'
import managercartonrank from '../view/ManagerCartonRank.vue'
import managergamerank from '../view/ManagerGameRank.vue'
import managershop from '../view/ManagerShop.vue'
import managershoprecord from '../view/ManagerShopRecord.vue'

const routes = [
  { path: '/', redirect: '/home' },
  {
    path: '/login', component: login, name: 'login'
  },
  {
    path: '/home', component: home, name:'home',
    redirect: '/main',
    children: [
      {
        path: '/main', component: main, name:'main'
      },
      {
        path: '/hotlist', component: hotlist, name:'hotlist'
      },
      {
        path: '/carton', component: carton, name:'carton'
      },
      {
        path: '/games', component: games, name:'games'
      },
      {
        path: '/tattle', component: tattle, name:'tattle'
      },
      {
        path: '/rank', component: rank, name:'rank',
        redirect: '/cartonrank',
        children:[
          {
            path: '/cartonrank', component: cartonrank, name:'cartonrank'
          },
          {
            path:'/gamerank', component: gamerank, name:'gamerank'
          },
          {
            path:'*', redirect: '/cartonrank'
          }
        ]
      },
      {
        path: '/shopping', component: shopping, name:'shopping'
      },
      {
        path: '/self', component: self, name:'self'
      },
      {
        path: '/noticearticle', component:noticearticle, name:'noticearticle'
      }
    ]
  },
  {
    path: '/content', component: content, name: 'content'
  },
  {
    path: '/release', component: release, name: 'release'
  },
  {
    path: '/managerlogin', component: managerlogin, name:'managerlogin'
  },
  {
    path: '/managermain', component: managermain, name:'managermain',
    redirect: '/managercartonrank',
    children: [
      {
        path: '/managercartonrank', component: managercartonrank, name:'managercartonrank'
      },
      {
        path: '/managergamerank', component: managergamerank, name:'managergamerank'
      },
      {
        path: '/managershop', component: managershop, name:'managershop'
      },
      {
        path: '/managershoprecord', component: managershoprecord, name:'managershoprecord'
      }
    ]
  }
]


export const router = createRouter({
  history: createWebHashHistory(),
  routes: routes
})


